package Action

import (

	"fmt"
	"github.com/syyongx/php2go"
	"hello/wl"
	"io"
	"net/http"
	"os"
)

type OAuthAction struct {

}


//下载http图片
func (this *OAuthAction)GetHttpImg(imgUrl string)string  {

	res, err := http.Get(imgUrl)
	if err != nil {
		panic(err)
	}
	imgName:=php2go.Uniqid("")+".jpg"
	pathName:=wl.UploadPath+imgName;

	fmt.Println(pathName)

	f, err := os.Create(pathName)
	if err != nil {
		panic(err)
	}
	io.Copy(f, res.Body)

	defer res.Body.Close()

	return imgName

}